import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import '../../model/station.dart';
import '../../pages/gmap/gmap.dart';
import '../../pages/station/station_map.dart';
import '../../widgets/dialogWidget.dart';
import '../../helper/routeHelper.dart';
import '../../helper/uidata.dart';

import '../../spaces/filespace/fileSpace.dart';

import 'station_list.dart';

class StationRecordHome extends StatefulWidget {
  @override
  StationRecordHome(this.station);
  final Station station;

  @override
  createState() => new StationRecordHomeState();
}

class StationRecordHomeState extends State<StationRecordHome> {
//  定义底部导航列表
  final List<BottomNavigationBarItem> bottomTabs = [
    new BottomNavigationBarItem(
        icon: new Icon(Icons.location_on), label: ('测站列表')),
    new BottomNavigationBarItem(
        icon: new Icon(FontAwesomeIcons.map), label: ('测站位置')),
    new BottomNavigationBarItem(
        icon: new Icon(FontAwesomeIcons.file), label: ('相关文件')),
  ];

  Widget getTable() {
    return DefaultTabController(
      length: 3,
      child: Scaffold(
        appBar: AppBar(
          bottom: TabBar(
            tabs: [
              Tab(text: "文字"),
              Tab(text: "照片"),
              Tab(text: "文件"),
            ],
          ),
          title: Text('测站记录'),
        ),
        body: TabBarView(
          children: [
            Icon(Icons.directions_car),
            Icon(Icons.directions_transit),
            Icon(Icons.directions_bike),
          ],
        ),
      ),
    );
  }

  Widget getTable2() {
    return DefaultTabController(
      length: 3,
      child: Scaffold(
        appBar: AppBar(
          title: TabBar(
            tabs: [
              Tab(icon: Icon(FontAwesomeIcons.wordpress)),
              Tab(icon: Icon(Icons.photo)),
              Tab(icon: Icon(FontAwesomeIcons.file)),
            ],
          ),
          // title: Text('测站记录'),
        ),
        body: TabBarView(
          children: [
            Icon(Icons.directions_car),
            Icon(Icons.directions_transit),
            Icon(Icons.directions_bike),
          ],
        ),
      ),
    );
  }

  Widget getBody(int i) {
    if (i == 0) return StationBookPage();
    if (i == 1) return StationMapPage();
    if (i == 2) return FileSpacePage(UIData.StationFileSpaceId, "测站相关文件", true);
    return new Container();
  }

  final titleList = ["测站列表", "测站位置", "相关文件"];
  int currentIndex = 0; //当前索引
  late Widget currentPage; //当前页面

  @override
  void initState() {
    super.initState();
    currentPage = getBody(0);
  }

  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return getTable();
  }
}
